package com.zhanghe.study.netty.decoder.lined;

import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * 服务端处理器
 * @author zh
 * @date 2020/12/2 11:33
 */
public class ServerHandler extends SimpleChannelInboundHandler<String> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, String msg) throws Exception {
        System.out.println("接收到的消息为：->"+msg);
        ctx.writeAndFlush(Unpooled.copiedBuffer("你也好_$".getBytes()));
    }
}
